#include <ctime>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;

const int MAXN=2005;
const int SIZE=70;
const int MAXM=20;
const double eps = 1e-7;
const int LIM=30;

int N, M, R;
int del[MAXM][SIZE];
int vis[SIZE];
int need[MAXM];
double sum[MAXM];
double ans;

int sgn(double a){
	if(fabs(a) < eps) return 0;
	if(a > 0) return 1;
	return -1;
}

struct point{
	double x, y, z;
	point(){}
	point(double x, double y, double z){
		this->x = x; this->y = y; this->z = z;
	}
	void read(){
		scanf("%lf %lf %lf", &x, &y, &z);
	}
	double len(){
		return sqrt(x * x + y * y + z * z);
	}
	double len2(){
		return x * x + y * y + z * z;
	}
	point operator-(const point &a) const{
		return point(x - a.x, y - a.y, z - a.z);
	}
	point operator*(const point &a) const{
		point ret;
		ret.x = y * a.z - a.y * z;
		ret.y = z * a.x - x * a.z;
		ret.z = x * a.y - y * a.x;
		return ret;
	}
	double operator^(const point &a) const{
		return x * a.x + y * a.y + z * a.z;
	}
}O;

struct Ball{
	point o;
	double r;
	void read(){
		o.read();
		scanf("%lf", &r);
	}
}ball[MAXN];

struct Light{
	point o;
	double b, T;
	void read(){
		o.read();
		scanf("%lf", &b);
	}
	void gao(){
		T = b / (o - O).len2();
	}
}light[MAXM];

inline double maxdis(const point &p, const point &a, const point &b)
{
	return max((p-a).len(), (p-b).len());
}

inline double mindis(const point &p, const point &a, const point &b)
{
	if (sgn((b-a)^(p-a))>=0&&sgn((a-b)^(p-b))>=0) return ((p-a)*(b-a)).len()/(b-a).len();
	else return min((p-a).len(), (p-b).len());
}

void init(){
	for(int i = 0; i < M; i++){
		light[i].gao();
		memset(del[i], 0, sizeof(del[i]));
		need[i]=0;
		for(int j = 0; j < N; j++){
			double d1=mindis(ball[j].o, light[i].o, O);
			double d2=maxdis(ball[j].o, light[i].o, O);
			if (sgn(ball[j].r-d1)>=0&&sgn(ball[j].r-d2)<0) del[i][j/LIM]|=(1<<(j%LIM)), need[i]++;
			if (need[i]>R) break;
		}
	}
}

void dfs(int dep, int cnt, double cur)
{
	if (dep==M)
	{
		ans=max(ans, cur);
		return;
	}
	if (sum[dep]+cur<ans) return;
	int tmp[SIZE], delta=0;
	if (need[dep]<=R)
	{
		memcpy(tmp, vis, sizeof(vis));
		for (int i=0; i<=N/LIM+1; i++)
		{
			int t1=__builtin_popcount(vis[i]);
			int t2=__builtin_popcount(del[dep][i]|vis[i]);
			if (t2>t1) delta+=t2-t1, vis[i]|=del[dep][i];
		}
		if (cnt+delta<=R) dfs(dep+1, cnt+delta, cur+light[dep].T);
		memcpy(vis, tmp, sizeof(tmp));
	}
	dfs(dep+1, cnt, cur);
}

double gao(){
	init();
	memset(sum, 0, sizeof(sum));
	memset(vis, 0, sizeof(vis));
	for (int i=M-1; i>=0; i--) sum[i]=sum[i+1]+light[i].T;
	ans=0;
	dfs(0, 0, 0);
	return ans;
}

int main(){
	while(3 == scanf("%d %d %d", &N, &M, &R)&&N){
		for(int i = 0; i < N; i++) ball[i].read();
		for(int i = 0; i < M; i++) light[i].read();
		O.read();
		printf("%.8lf\n", gao());
	}
	return 0;
}
